package view;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;


public class Home extends JFrame {
	public Home() {
		// Frame				
				setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
				setBounds(500, 20, 480, 680);
				this.setResizable(false);
				JPanel contentPane = new JPanel();
				contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
				contentPane.setLayout(null);
				setContentPane(contentPane);
				
		// Button Panel 
				JPanel panel = new JPanel();
				panel.setBounds(0, 465, 484, 196);
				panel.setLayout(null);
				panel.setOpaque(false);
				contentPane.add(panel);
		
		// Button New Game
				JButton btn_NewGame = new JButton("NEW GAME");
				btn_NewGame.setBounds(10, 11, 224, 80);
				btn_NewGame.addActionListener(new ActionListener() {
					
					@Override
					public void actionPerformed(ActionEvent e) {
						Handle_New_Game();						
					}
				});
				panel.add(btn_NewGame);
				
		// Button High Score
				JButton btn_HighScore = new JButton("HIGH SCORE");
				btn_HighScore.setBounds(10, 102, 224, 80);
				btn_HighScore.addActionListener(new ActionListener() {
					
					@Override
					public void actionPerformed(ActionEvent arg0) {
						Handle_High_Score();
						
					}
				});
				panel.add(btn_HighScore);
				
		// Button Add Question
				JButton btn_AddQuestion = new JButton("ADD QUESTION");
				btn_AddQuestion.setBounds(244, 11, 224, 80);
				btn_AddQuestion.addActionListener(new ActionListener() {
					
					@Override
					public void actionPerformed(ActionEvent e) {
						Handle_Add_Question();						
					}
				});
				panel.add(btn_AddQuestion);
				
		// Button Exit
				JButton btn_Exit = new JButton("EXIT ");
				btn_Exit.setBounds(244, 102, 224, 80);
				btn_Exit.addActionListener(new ActionListener() {
					
					@Override
					public void actionPerformed(ActionEvent e) {
						Handle_Exit();						
					}
				});
				panel.add(btn_Exit);
				
		//Background
				JLabel lblNewLabel = new JLabel("");
				lblNewLabel.setBounds(0, 0, 484, 661);
				lblNewLabel.setIcon(new ImageIcon("img/Rongvang.jpg"));
				contentPane.add(lblNewLabel);						
	}

	public void Handle_New_Game()
	{
		//Button New Game
		
		New_Game new_game = new New_Game();
		new_game.setVisible(true);
		this.hide();
	}
	
	public void Handle_High_Score()
	{
		//Button High Score
		/*High Score high_score = new High_Score();
		  high_score.setVisible(true); */
		this.hide();
	}
	
	public void Handle_Add_Question()
	{		
		//Button Add Question
		  /*Add_Question add_question = new Add_Question();
		  add_question.setVisible(true);*/
		  this.hide();
	}
	
	public void Handle_Exit()
	{
		System.exit(0);
	}
}
